package com.some;

class Solution_1 {
    boolean res = false;

    public boolean twoSum(int[] nums, int target) {
        findRes(nums, target, nums.length - 1);
        return res;
    }

    public void findRes(int[] nums, int target, int index) {
        if (target == 0) {
            res = true;
            return;
        }
        if (target < 0 || index < 0) {
            return;
        }
        findRes(nums, target - nums[index], index - 1);
        findRes(nums, target, index - 1);
    }

    public static void main(String[] args) {
        Solution_1 solution_1 = new Solution_1();
        System.out.println(solution_1.twoSum(new int[]{1, 2, 3, 4, 5, 6, 7}, 9));
    }
}